import type { User, CodeType, UserInfo, Patient } from '@/types/user'
import { request } from '@/utils/request'

// 密码登录
export const loginByPassword = (mobile: string, password: string) =>
  request<User>('/login/password', 'post', { mobile, password })

// 验证码

export const sendMobileCode = (mobile: string, type: CodeType) =>
  request<{ code: string }>('/code', 'get', { mobile, type })

// 验证码登录
export const loginByMobile = (mobile: string, code: string) =>
  request<User>('/login', 'post', { mobile, code })

// 获取用户详细信息
export const getUserInfo = () => request<UserInfo>('/patient/myUser', 'GET')

// 获取家庭档案列表
export const getPatientList = () => request<Patient[]>('/patient/mylist', 'GET')
